﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Net;
using Netpong.Networking;
using NetPong.Networking;

namespace NetPong
{
    public class Score : ITransmittable
    {
        public Vector2 score;
        public int ObjectId { get { return objectId; } }
        private int objectId;

        public Score(NetworkManager nm)
        {
            objectId = nm.CreateNetworkObj(this);
            score.X = 0;
            score.Y = 0;
        }

        public PacketWriter WriteToNetwork()
        {
            PacketWriter packetWriter = new PacketWriter();
            packetWriter.Write(ObjectId);
            packetWriter.Write('S');
            packetWriter.Write(score);
            return packetWriter;
        }

        public void UpdateFromNetwork(PacketReader packetReader)
        {
            score = packetReader.ReadVector2();
        }

        public void Render(GameTime gt) { }
    }
}
